<%@ page contentType="text/html; charset=gbk" pageEncoding="utf-8" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>客户联系人</title>
<link href="../style/main.css" rel="stylesheet" type="text/css" />
<link type="text/css" rel="stylesheet" href="../style/style.css" />

<%@ taglib prefix="s" uri="/struts-tags" %>

<script type="text/javascript">
	function submitForm()
	{
		searchContactForm.submit();
	}
	function gotoPage(page)
	{
		if(page == 0)
		{
			searchContactForm.pageNumber.value = document.getElementById("t_pageNumber").value;
			searchContactForm.pageSize.value = document.getElementById("t_pageSize").value;
		}
		else
		{
			searchContactForm.pageNumber.value = page;
		}
		searchContactForm.submit();
	}
	function startEdit()
	{
		var obj;
		var i = 0;
		while((obj = document.getElementById("chk"+i)) != null)
		{
			if(obj.checked)
			{
				document.location="contact!startEdit?contactId="+obj.value;
				return;
			}
			i++;
		}
		alert("必须选择一个联系人");
	}
	function removeContact()
	{
		var obj;
		var i = 0,counter = 0,id;
		while((obj = document.getElementById("chk"+i)) != null)
		{
			if(obj.checked)
			{
				id = obj.value;
				counter ++;
			}
			i++;
		}
		if(counter > 1)
			alert("只能删除一个联系人");
		else if(counter == 1)
		{
			if(confirm("确定删除？") == true)
			{
				var number = searchContactForm.pageNumber.value;
				var size = searchContactForm.pageSize.value;
				document.location = "contact!removeContact?contactId="+id+"&page.pageNumber="+number+"&page.pageSize="+size;
			}
		}
		else
			alert("必须选择一个联系人");
	}
</script>

</head>
<body>
<table width="1200" cellpadding="0" cellspacing="0" class="table">
  <tr>
    <td>
      <table width="100%"  cellpadding="0" cellspacing="0" class="table2">
        <tr>
          <td valign="top">
            <table width="100%" class="top" cellpadding="0" cellspacing="0">
              <tr>
                <td>当前位置:&nbsp;客户管理&nbsp;>>&nbsp;联系人</td>
              </tr>
            </table>
	<div id="mainareacontent">
        <div class="mainarea">
            <div class="search">			
			 <s:form name="searchContactForm" id="searchContactForm" action="contact!searchContact" method="post" theme="simple">
                <table width="100%" cellpadding="0" cellspacing="0">
                    <tr>
                        <td class="ico">&nbsp;</td>
                  		<td >
                            <table width="100%" border="0" cellpadding="0" cellspacing="0" >
          						<tr>
                                    <th width="9%">联系人名称： </th>
                                    <td width="18%">
                            			<s:textfield name="contact.contactName" ></s:textfield>
                            		</td>
		                            <th width="6%">客户编号： </th>
		                            <td width="17%">
                            			<s:textfield name="contact.client.clientId" ></s:textfield>
		                            </td>
		        					<td width="50%" >
		                                <a onclick="javascript:submitForm();" href="javascript:void(0);"><img src="../images/btn_search.gif" width="50" height="20" /></a>
		                            </td>
                                </tr>
                                <tr>
									<th>联系人手机：</th>
									<td>
                            			<s:textfield name="contact.contactPhone" ></s:textfield>
									</td>
									<th>客户名称： </th>
									<td>
                            			<s:textfield name="contact.client.clientName" ></s:textfield>
									</td>
									<td>
										<img src="../images/btn_reset.gif" width="50" height="20" />
									</td>
                            	</tr>
                      		</table>
                      </td>
                    </tr>
                  </table>
                  <s:hidden id="pageNumber" name="page.pageNumber" />
                  <s:hidden id="pageSize" name="page.pageSize" />
                </s:form>
            </div>
            <!----------- 数据列表 ------------------>

                    <table width="100%" cellpadding="0" cellspacing="0"class="table3">
                        <tr>
                            <td width="6%" class="title">&nbsp;</td>
                            <td width="5%" >
                            	<a href="clientContact_new.jsp"><span class="clientinfo_but" >新&nbsp;增</span></a>
                            </td>
                            <td width="5%" >
                            	<span class="clientinfo_but" ><a href="javascript:void(0);" onclick="javascript:startEdit();">修&nbsp;改</a></span>
                            </td>
                            <td width="5%" >
                            	<a href="javascript:void(0);" onclick="javascript:removeContact();"><img src="../images/btn_del.gif" alt="3" width="50" height="20" /></a>
                            </td>
                            <td width="5%" >
                            	<img src="../images/btn_refresh.gif" alt="3" width="50" height="20" />
                            </td>
                            <td width="18%" >&nbsp;</td>
                            <td width="5%" ><span class="clientinfo_but">导&nbsp;入</span></td>
                            <td width="5%" ><span class="clientinfo_but">导&nbsp;出</span></td>
                          
                            <td width="5%" ><span class="clientinfo_but">打&nbsp;印</span></td>  
                            <td width="14%" >&nbsp;</td>
                        </tr>
                    </table>

            <table width="100%" cellpadding="0" cellspacing="1" class="dg_borderstyle">
            <thead>
				<tr>
	                <th width="35"> <input type="checkbox" onclick="docheck()" id="chk_all" /></th>
	                <th width="100">客户编号</th>
	                <th width="72">联系人</th>
	                <th width="143">联系人身份证</th>
	                <th width="110">联系人手机</th>
	                <th width="96">联系人电话</th>
	                <th width="96">传真</th>
	                <th width="92">出生日期</th>
	                <th width="175">电子邮箱</th>
                </tr>
            </thead>
            <s:iterator value="#request.contactList" status="st" id="contactList">
             <tr>
                <td>
            		<s:checkbox name="chks" id="%{'chk'+#st.getIndex()}" fieldValue="%{contactId}" theme="simple" />
				</td>
                <td>
                	<a href="clientInfo!showClientInfo?clientId=<s:property value='client.clientId'/>" >
                		<s:property value="client.clientId" default=""/>
                	</a>
                </td>
                <td>
                	<a href="contact!showContactInfo?contactId=<s:property value='contactId'/>">
                		<s:property value="contactName" default=""/>
                	</a>
                </td>
                <td>
                	<s:property value="contactIdcard" default=""/>
                </td>
                <td>
                	<s:property value="contactPhone" default=""/>
                </td>
                <td>
                	<s:property value="contacttele" default="" />
                </td>
                <td>
                	<s:property value="contactfax" default="" />
                </td>
                <td>
                	<s:date name="contactBornDate" format="yyyy-MM-dd" />
                </td>
                <td>
                	<s:property value="contactemail" default="" />
                </td>
             </tr>
            </s:iterator>
            </table>

            <table width="100%" cellpadding="0" cellspacing="0" class="dg_pagestyle">
                <tr>
                    <td class="pageinfo">
                        	第<s:property value="page.pageNumber"/>页 | 共<s:property value="page.totalPage"/>页
                    </td>
                    <td class="pagebutton">
                        每页
                        <s:select id="t_pageSize" name="page.pageSize" list="{'10','20','30','40','50'}" theme="simple">
                        </s:select>
                        条记录 | 第
                        <s:textfield id="t_pageNumber" name="page.pageNumber" cssStyle="width: 20px;" theme="simple" />
                        页
                        <a onclick="javascript:gotoPage(0);" href="javascript:void(0);">
                        	<img src="../images/btn_go.gif" />
                        </a>
                        <a onclick="javascript:gotoPage(1);" href="javascript:void(0);">
                        	<img src="../images/btn_sy.gif" width="55" height="20" />
                        </a>
                        <a onclick="javascript:gotoPage(<s:property value='page.prePage' />);" 
                        		href="javascript:void(0);">
                        	<img src="../images/btn_syy.gif" width="55" height="20" />
                        </a>
                        <a onclick="javascript:gotoPage(<s:property value='page.nextPage' />);" 
                        		href="javascript:void(0);">
                        	<img src="../images/btn_xyy.gif" width="55" height="20" />
                        </a>
                        <a onclick="javascript:gotoPage(<s:property value='page.lastPage' />);" 
                        		href="javascript:void(0);">
                        	<img src="../images/btn_wy.gif" width="55" height="20" />
                        </a>
                    </td>
                </tr>
            </table>
        </div>
      </div>          </td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>
